package com.d3works.apps.supplychain.service;

import com.d3works.apps.account.db.Account;
import com.d3works.apps.account.db.Journal;
import com.d3works.apps.account.db.Move;
import com.d3works.apps.account.service.AccountingCutOffService;
import com.d3works.apps.base.db.Batch;
import com.d3works.apps.base.db.Company;
import com.d3works.apps.stock.db.StockMove;
import com.d3works.apps.stock.db.StockMoveLine;
import com.d3works.db.Query;
import com.d3works.exception.D3worksException;
import com.d3works.meta.CallMethod;
import com.google.inject.persist.Transactional;
import java.time.LocalDate;
import java.util.List;

public interface AccountingCutOffSupplyChainService extends AccountingCutOffService {

  public Query<StockMove> getStockMoves(
      Company company, int accountingCutOffTypeSelect, LocalDate moveDate);

  @Transactional(rollbackOn = {Exception.class})
  public List<Move> generateCutOffMovesFromStockMove(
      StockMove stockMove,
      Journal miscOpeJournal,
      LocalDate moveDate,
      LocalDate reverseMoveDate,
      String moveDescription,
      String reverseMoveDescription,
      int accountingCutOffTypeSelect,
      int cutOffMoveStatusSelect,
      boolean recoveredTax,
      boolean ati,
      boolean includeNotStockManagedProduct,
      boolean automaticReverse,
      boolean automaticReconcile,
      Account forecastedInvCustAccount,
      Account forecastedInvSuppAccount,
      String prefixOrigin)
      throws D3worksException;

  public Move generateCutOffMoveFromStockMove(
      StockMove stockMove,
      List<StockMoveLine> sortedStockMoveLine,
      Journal miscOpeJournal,
      LocalDate moveDate,
      LocalDate originDate,
      String moveDescription,
      int cutOffMoveStatusSelect,
      boolean isPurchase,
      boolean recoveredTax,
      boolean ati,
      boolean includeNotStockManagedProduct,
      boolean isReverse,
      Account forecastedInvCustAccount,
      Account forecastedInvSuppAccount,
      String prefixOrigin)
      throws D3worksException;

  @CallMethod
  List<Long> getStockMoveLines(Batch batch);
}
